.class public Lde/dealdoktor/app/activities/TopDeals;
.super Lde/dealdoktor/app/activities/SuperListing;
.source "TopDeals.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lde/dealdoktor/app/activities/TopDeals$GetBookmarksTask;,
        Lde/dealdoktor/app/activities/TopDeals$GetTopDealsTask;
    }
.end annotation


# instance fields
.field private bookmarks:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field private broadcastReceiver:Landroid/content/BroadcastReceiver;

.field private info:Landroid/widget/TextView;

.field private tab:I


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 27
    invoke-direct {p0}, Lde/dealdoktor/app/activities/SuperListing;-><init>()V

    .line 31
    const/4 v0, 0x0

    iput v0, p0, Lde/dealdoktor/app/activities/TopDeals;->tab:I

    .line 33
    new-instance v0, Lde/dealdoktor/app/activities/TopDeals$1;

    invoke-direct {v0, p0}, Lde/dealdoktor/app/activities/TopDeals$1;-><init>(Lde/dealdoktor/app/activities/TopDeals;)V

    iput-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->broadcastReceiver:Landroid/content/BroadcastReceiver;

    .line 27
    return-void
.end method

.method static synthetic access$0(Lde/dealdoktor/app/activities/TopDeals;)V
    .locals 0
    .parameter

    .prologue
    .line 68
    invoke-direct {p0}, Lde/dealdoktor/app/activities/TopDeals;->init()V

    return-void
.end method

.method static synthetic access$1(Lde/dealdoktor/app/activities/TopDeals;)Ljava/util/ArrayList;
    .locals 1
    .parameter

    .prologue
    .line 30
    iget-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->bookmarks:Ljava/util/ArrayList;

    return-object v0
.end method

.method private init()V
    .locals 1

    .prologue
    .line 69
    const/4 v0, 0x0

    sput-boolean v0, Lde/dealdoktor/app/App;->updateTopDeals:Z

    .line 70
    iget v0, p0, Lde/dealdoktor/app/activities/TopDeals;->tab:I

    if-nez v0, :cond_0

    .line 71
    invoke-direct {p0}, Lde/dealdoktor/app/activities/TopDeals;->initTopDealsApp()V

    .line 75
    :goto_0
    return-void

    .line 73
    :cond_0
    invoke-direct {p0}, Lde/dealdoktor/app/activities/TopDeals;->initTopDealsUser()V

    goto :goto_0
.end method

.method private initTopDealsApp()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 90
    iput v2, p0, Lde/dealdoktor/app/activities/TopDeals;->tab:I

    .line 91
    iget-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->info:Landroid/widget/TextView;

    const/16 v1, 0x8

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setVisibility(I)V

    .line 92
    new-instance v0, Lde/dealdoktor/app/activities/TopDeals$GetTopDealsTask;

    invoke-direct {v0, p0}, Lde/dealdoktor/app/activities/TopDeals$GetTopDealsTask;-><init>(Lde/dealdoktor/app/activities/TopDeals;)V

    new-array v1, v2, [Ljava/lang/String;

    invoke-virtual {v0, v1}, Lde/dealdoktor/app/activities/TopDeals$GetTopDealsTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 93
    return-void
.end method

.method private initTopDealsUser()V
    .locals 5

    .prologue
    const/4 v4, 0x0

    .line 97
    const/4 v2, 0x1

    iput v2, p0, Lde/dealdoktor/app/activities/TopDeals;->tab:I

    .line 98
    iget-object v2, p0, Lde/dealdoktor/app/activities/TopDeals;->listAdapter:Lde/dealdoktor/app/adapter/PostListAdapter;

    invoke-virtual {v2}, Lde/dealdoktor/app/adapter/PostListAdapter;->clear()V

    .line 99
    new-instance v0, Lde/dealdoktor/app/db/BaseModel;

    const-string v2, "bookmarks"

    invoke-direct {v0, p0, v2}, Lde/dealdoktor/app/db/BaseModel;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    .line 100
    .local v0, bookmarksModel:Lde/dealdoktor/app/db/BaseModel;
    invoke-virtual {v0}, Lde/dealdoktor/app/db/BaseModel;->getAll()Landroid/database/Cursor;

    move-result-object v1

    .line 101
    .local v1, c:Landroid/database/Cursor;
    new-instance v2, Ljava/util/ArrayList;

    invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V

    iput-object v2, p0, Lde/dealdoktor/app/activities/TopDeals;->bookmarks:Ljava/util/ArrayList;

    .line 102
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v2

    if-eqz v2, :cond_1

    .line 104
    :cond_0
    iget-object v2, p0, Lde/dealdoktor/app/activities/TopDeals;->bookmarks:Ljava/util/ArrayList;

    invoke-interface {v1, v4}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 105
    invoke-interface {v1}, Landroid/database/Cursor;->moveToNext()Z

    move-result v2

    .line 103
    if-nez v2, :cond_0

    .line 106
    new-instance v2, Lde/dealdoktor/app/activities/TopDeals$GetBookmarksTask;

    invoke-direct {v2, p0}, Lde/dealdoktor/app/activities/TopDeals$GetBookmarksTask;-><init>(Lde/dealdoktor/app/activities/TopDeals;)V

    new-array v3, v4, [Ljava/lang/String;

    invoke-virtual {v2, v3}, Lde/dealdoktor/app/activities/TopDeals$GetBookmarksTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 110
    :goto_0
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 111
    return-void

    .line 108
    :cond_1
    iget-object v2, p0, Lde/dealdoktor/app/activities/TopDeals;->info:Landroid/widget/TextView;

    invoke-virtual {v2, v4}, Landroid/widget/TextView;->setVisibility(I)V

    goto :goto_0
.end method


# virtual methods
.method protected go(I)V
    .locals 5
    .parameter "position"

    .prologue
    .line 78
    iget-object v3, p0, Lde/dealdoktor/app/activities/TopDeals;->listAdapter:Lde/dealdoktor/app/adapter/PostListAdapter;

    iget-object v3, v3, Lde/dealdoktor/app/adapter/PostListAdapter;->postList:Ljava/util/ArrayList;

    sput-object v3, Lde/dealdoktor/app/App;->topDeals:Ljava/util/ArrayList;

    .line 79
    sget-object v3, Lde/dealdoktor/app/App;->topDeals:Ljava/util/ArrayList;

    if-eqz v3, :cond_0

    sget-object v3, Lde/dealdoktor/app/App;->topDeals:Ljava/util/ArrayList;

    invoke-virtual {v3}, Ljava/util/ArrayList;->size()I

    move-result v3

    if-le v3, p1, :cond_0

    .line 80
    new-instance v0, Landroid/content/Intent;

    invoke-virtual {p0}, Lde/dealdoktor/app/activities/TopDeals;->getParent()Landroid/app/Activity;

    move-result-object v3

    const-class v4, Lde/dealdoktor/app/activities/TopDealsDetails;

    invoke-direct {v0, v3, v4}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 81
    .local v0, details:Landroid/content/Intent;
    const-string v3, "postId"

    invoke-virtual {v0, v3, p1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    .line 82
    invoke-virtual {p0}, Lde/dealdoktor/app/activities/TopDeals;->getParent()Landroid/app/Activity;

    move-result-object v1

    check-cast v1, Lde/dealdoktor/app/activities/TabGroupActivity;

    .line 83
    .local v1, parentActivity:Lde/dealdoktor/app/activities/TabGroupActivity;
    new-instance v2, Ljava/util/Random;

    invoke-direct {v2}, Ljava/util/Random;-><init>()V

    .line 84
    .local v2, rand:Ljava/util/Random;
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "Details"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const v4, 0xf4240

    invoke-virtual {v2, v4}, Ljava/util/Random;->nextInt(I)I

    move-result v4

    invoke-static {v4}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v1, v3, v0}, Lde/dealdoktor/app/activities/TabGroupActivity;->startChildActivity(Ljava/lang/String;Landroid/content/Intent;)V

    .line 86
    .end local v0           #details:Landroid/content/Intent;
    .end local v1           #parentActivity:Lde/dealdoktor/app/activities/TabGroupActivity;
    .end local v2           #rand:Ljava/util/Random;
    :cond_0
    return-void
.end method

.method public onBackPressed()V
    .locals 1

    .prologue
    .line 115
    invoke-virtual {p0}, Lde/dealdoktor/app/activities/TopDeals;->getParent()Landroid/app/Activity;

    move-result-object v0

    check-cast v0, Lde/dealdoktor/app/activities/TabGroupActivity;

    .line 116
    .local v0, parentActivity:Lde/dealdoktor/app/activities/TabGroupActivity;
    invoke-virtual {v0}, Lde/dealdoktor/app/activities/TabGroupActivity;->onBackPressed()V

    .line 117
    return-void
.end method

.method public onClickTopDealsApp(Landroid/view/View;)V
    .locals 2
    .parameter "v"

    .prologue
    .line 120
    invoke-virtual {p1}, Landroid/view/View;->requestFocusFromTouch()Z

    .line 121
    invoke-direct {p0}, Lde/dealdoktor/app/activities/TopDeals;->initTopDealsApp()V

    .line 123
    const v0, 0x7f0b000e

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/activities/TopDeals;->findViewById(I)Landroid/view/View;

    move-result-object v0

    const v1, 0x7f020022

    invoke-virtual {v0, v1}, Landroid/view/View;->setBackgroundResource(I)V

    .line 124
    const v0, 0x7f0b000f

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/activities/TopDeals;->findViewById(I)Landroid/view/View;

    move-result-object v0

    const v1, 0x7f02002c

    invoke-virtual {v0, v1}, Landroid/view/View;->setBackgroundResource(I)V

    .line 125
    return-void
.end method

.method public onClickTopDealsUser(Landroid/view/View;)V
    .locals 2
    .parameter "v"

    .prologue
    .line 128
    invoke-virtual {p1}, Landroid/view/View;->requestFocusFromTouch()Z

    .line 129
    invoke-direct {p0}, Lde/dealdoktor/app/activities/TopDeals;->initTopDealsUser()V

    .line 131
    const v0, 0x7f0b000e

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/activities/TopDeals;->findViewById(I)Landroid/view/View;

    move-result-object v0

    const v1, 0x7f02002c

    invoke-virtual {v0, v1}, Landroid/view/View;->setBackgroundResource(I)V

    .line 132
    const v0, 0x7f0b000f

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/activities/TopDeals;->findViewById(I)Landroid/view/View;

    move-result-object v0

    const v1, 0x7f020022

    invoke-virtual {v0, v1}, Landroid/view/View;->setBackgroundResource(I)V

    .line 133
    return-void
.end method

.method protected onCreate(Landroid/os/Bundle;)V
    .locals 3
    .parameter "savedInstanceState"

    .prologue
    .line 42
    invoke-super {p0, p1}, Lde/dealdoktor/app/activities/SuperListing;->onCreate(Landroid/os/Bundle;)V

    .line 43
    const v0, 0x7f03000a

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/activities/TopDeals;->setContentView(I)V

    .line 45
    const v0, 0x7f0b0010

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/activities/TopDeals;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->info:Landroid/widget/TextView;

    .line 46
    invoke-virtual {p0}, Lde/dealdoktor/app/activities/TopDeals;->getParent()Landroid/app/Activity;

    move-result-object v0

    invoke-virtual {v0}, Landroid/app/Activity;->getParent()Landroid/app/Activity;

    move-result-object v0

    check-cast v0, Lde/dealdoktor/app/activities/Tabs;

    iput-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->tabs:Lde/dealdoktor/app/activities/Tabs;

    .line 49
    const v0, 0x7f0b0009

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/activities/TopDeals;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ListView;

    iput-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->results:Landroid/widget/ListView;

    .line 52
    new-instance v0, Lde/dealdoktor/app/adapter/PostListAdapter;

    sget-object v1, Lde/dealdoktor/app/App;->topDeals:Ljava/util/ArrayList;

    iget-object v2, p0, Lde/dealdoktor/app/activities/TopDeals;->results:Landroid/widget/ListView;

    invoke-direct {v0, v1, p0, v2}, Lde/dealdoktor/app/adapter/PostListAdapter;-><init>(Ljava/util/ArrayList;Lde/dealdoktor/app/activities/SuperListing;Landroid/widget/ListView;)V

    iput-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->listAdapter:Lde/dealdoktor/app/adapter/PostListAdapter;

    .line 53
    iget-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->results:Landroid/widget/ListView;

    iget-object v1, p0, Lde/dealdoktor/app/activities/TopDeals;->listAdapter:Lde/dealdoktor/app/adapter/PostListAdapter;

    invoke-virtual {v0, v1}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 56
    iget-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->results:Landroid/widget/ListView;

    new-instance v1, Lde/dealdoktor/app/activities/TopDeals$2;

    invoke-direct {v1, p0}, Lde/dealdoktor/app/activities/TopDeals$2;-><init>(Lde/dealdoktor/app/activities/TopDeals;)V

    invoke-virtual {v0, v1}, Landroid/widget/ListView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 63
    sget-object v0, Lde/dealdoktor/app/App;->topDeals:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    if-nez v0, :cond_0

    .line 64
    invoke-direct {p0}, Lde/dealdoktor/app/activities/TopDeals;->init()V

    .line 66
    :cond_0
    return-void
.end method

.method protected onPause()V
    .locals 1

    .prologue
    .line 233
    invoke-super {p0}, Lde/dealdoktor/app/activities/SuperListing;->onPause()V

    .line 234
    iget-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->broadcastReceiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/activities/TopDeals;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 235
    return-void
.end method

.method protected onResume()V
    .locals 3

    .prologue
    .line 224
    invoke-super {p0}, Lde/dealdoktor/app/activities/SuperListing;->onResume()V

    .line 225
    iget-object v0, p0, Lde/dealdoktor/app/activities/TopDeals;->broadcastReceiver:Landroid/content/BroadcastReceiver;

    new-instance v1, Landroid/content/IntentFilter;

    const-string v2, "de.dealdoktor.broadcastaction.update"

    invoke-direct {v1, v2}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    invoke-virtual {p0, v0, v1}, Lde/dealdoktor/app/activities/TopDeals;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 226
    sget-boolean v0, Lde/dealdoktor/app/App;->updateTopDeals:Z

    if-eqz v0, :cond_0

    .line 227
    invoke-direct {p0}, Lde/dealdoktor/app/activities/TopDeals;->init()V

    .line 229
    :cond_0
    return-void
.end method
